package components;

import java.awt.Container;
import java.rmi.RemoteException;

import javax.swing.JFrame;
import javax.swing.JPanel;

import main.Main;


import ui.LoginPanel;
import utils.PanelFactory;

public class MyFrame extends JFrame{
	
	public static final int WIDTH=800;
	public static final int HEIGHT=480;
	public static final String NAME="总经理界面";
	
	private static MyPanel mp;
	
	
	public void updateVO(){
		mp.updateVO();
	}
	
	public MyFrame(){
		Container c=getContentPane();
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	    setSize(WIDTH,HEIGHT);
	    setTitle(NAME);
	    setResizable(false);
	    setLocationRelativeTo(null);	
	    setVisible(true);
	    
	    try {
			mp=PanelFactory.makePanel(Main.getLogic().getState());
		} catch (RemoteException e) {
			e.printStackTrace();
		}
	    add(mp);
	    mp.revalidate();
        mp.requestFocus();
	}
	
	public void changePanel(MyPanel tmp){
		remove(mp);
		mp=tmp;
		add(mp);
		mp.revalidate();
        mp.requestFocus();
	}


}

